#pragma once
#include "Drawable.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkImage.h"

namespace yzrilyzr_simplecanvas{
	enum ImageScaleMode{
		NONE,
		FIT_XY,
		FIT_START,
		FIT_CENTER,
		FIT_END,
		CENTER,
		CENTER_CROP,
		CENTER_INSIDE
	};
	ECLASS(ImageDrawable, public Drawable){
	private:
	sk_sp<SkImage> image=nullptr;
	ImageScaleMode mode=ImageScaleMode::NONE;
	public:
	ImageDrawable(sk_sp<SkImage> bmp){
		this->image=bmp;
	}
	ImageDrawable(const std::string & filePath);
	void draw(SkCanvas & canvas)override;
	void setScaleMode(ImageScaleMode mode){
		this->mode=mode;
	}
	int32_t getIntrinsicWidth()override;
	int32_t getIntrinsicHeight()override;
	};
}